# Contributor: Bart Ribbers <bribbers@disroot.org>
# Maintainer: Bart Ribbers <bribbers@disroot.org>
pkgname=mycroft-core
pkgver=21.2.2
pkgrel=0
pkgdesc="Mycroft Core, the Mycroft Artificial Intelligence platform"
url="https://mycroft.ai/"
# s390x blocked by mimic1, py3-precise-runner
arch="noarch !s390x"
license="Apache-2.0"
depends="
	mimic1
	mycroft-skills-kit
	mycroft-skills-manager
	py3-adapt-parser
	py3-dateutil
	py3-fann2
	py3-fasteners
	py3-gtts
	py3-inflection
	py3-lingua-franca
	py3-mycroft-messagebus-client
	py3-padaos
	py3-padatious
	py3-petact
	py3-pillow
	py3-pocketsphinx
	py3-precise-runner
	py3-psutil
	py3-pyaudio
	py3-pyee
	py3-requests
	py3-requests-futures
	py3-pyserial
	py3-speechrecognition
	py3-tornado
	py3-websocket-client
	py3-xdg
	py3-yaml
	python3
	"
# These dependencies are required to play audio with the local backend
# mpg123: mpg123
# pulseaudio-utils: paplay
# vorbis-tools: ogg123
depends="$depends
	mpg123
	pulseaudio-utils
	vorbis-tools
	"
makedepends="py3-setuptools"
checkdepends="
	py3-pytest
	py3-vlc
	py3-wheel
	"
install="$pkgname.post-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/MycroftAI/mycroft-core/archive/release/v$pkgver.tar.gz
	profile.sh
	0001-loose-requirements.patch
	0003-system-wide-setups.patch
	0004-skills-from-xdg.patch
	"
# Net is required for tests
# Some tests are broken still, will be enabled later
options="!check"
builddir="$srcdir/mycroft-core-release-v$pkgver"

build() {
	MYCROFT_LOOSE_REQUIREMENTS=1 python3 setup.py build
}

check() {
	# test_hotword_factory and test_local_recognizer fail
	# https://github.com/MycroftAI/mycroft-core/issues/2574
	PYTHONPATH="$PWD/build/lib" pytest -rRxs -k 'not testInvalid and not testListenerConfig'
}

package() {
	MYCROFT_LOOSE_REQUIREMENTS=1 python3 setup.py install --prefix=/usr --root="$pkgdir"

	install -Dm644 "$srcdir"/profile.sh "$pkgdir"/etc/profile.d/mycroft.sh
}
sha512sums="
850711f7fc6150349f1b4a979342bc186e40b618e5fd6a5bc6ab845083c2f93fd0c96a0e1efb7f4636a6d768ee03b4aae478ec31ae63bf553d0af673dfbb793e  mycroft-core-21.2.2.tar.gz
c3d1a605a0b574c8e2c4031f592bdbf023f5ed9b2e1ba0cea38cf79278331f245dbe4e220e7f81de73fe612ffd722253805058dae04ba89c3d01c361b329e4ef  profile.sh
f78dd1fcf40ada2d11f6a6e363180004de53d52fb9491c43704e9057fbc8f95981b17a413caf9c1bd508778b3cb4c33535f4fbdf23c1d5fefe2c6e4c719684b6  0001-loose-requirements.patch
a7af648664c371284af0b3596ec5565db3936680fe16f9adc68a2bf0af91c41427b0695af2c1c793ee725c3a6bfbf893954dd4ade880864c4679ce266649a54c  0003-system-wide-setups.patch
6628a97a528ea005f291b59e975a11b315cf13fb6270b826f4e33a7aa017026a53b7b1c6a5a61844330267a3852b395a59723185a391c8d1510939b0e98654fe  0004-skills-from-xdg.patch
"
